package com.suning.sawp.service.impl.clerk;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

import com.suning.sawp.dto.clerk.InvitationCodeInfo;
import com.suning.sawp.intf.clerk.InvitationCodeInfoService;
import com.suning.sawp.po.store.StoreInfo.StoreAttributes;

/**
 * 
 * 店员邀请码数据<br> 
 * 〈功能详细描述〉
 *
 * @author 13071470
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Service
public class InvitationCodeInfoServiceImpl implements InvitationCodeInfoService{

	@Resource
    MongoTemplate mongoTemplate;
	
	public InvitationCodeInfo queryInvitationCodeByRegionCode(String regionCode) {
		Query query = new Query();
        Criteria criteria = new Criteria();
        criteria.and(StoreAttributes.REGION_CODE).is(regionCode);
        query.addCriteria(criteria);
        return mongoTemplate.findOne(query, InvitationCodeInfo.class, "InvitationCode");
	}

}
